<template>
  <div>
    <h2>会员详情</h2>
    <table border="1">
      <tr>
        <td>名字</td>
        <td>{{ state.vname }}</td>
      </tr>
      <tr>
        <td>性别</td>
        <td>{{ state.sex }}</td>
      </tr>
      <tr>
        <td>手机号</td>
        <td>{{ state.phone }}</td>
      </tr>
      <tr>
        <td>余额</td>
        <td>{{ state.vprice }}</td>
      </tr>
      <tr>
        <td>积分</td>
        <td>{{ state.targe }}</td>
      </tr>
    </table>
  </div>
</template>

<script setup lang="ts">
import { reactive, toRefs, onMounted } from "vue";
import { useRouter, useRoute } from "vue-router";
import moment from "moment";
import axios from "axios";

const route = useRoute();
const router = useRouter();

let data: any = reactive({
  state: {},
});

let { state } = toRefs(data);

onMounted(() => {
  getData();
});

const getData = () => {
  let obj = {
    id: route.query.vid,
  };
  axios({
    url: "/api/Vip/Fan",
    method: "get",
    params: obj,
  })
    .then((res) => {
      console.log(res);
      state.value = res.data.data;
    })
    .catch((err) => {
      console.log(err);
    });
};
</script>

 